package com.example.sxy.observerdemo;

import java.util.Observable;

/**
 * Created by SXY on 2015/11/25.
 */
public class ObservableDemo extends Observable {
    private String weather;

    public ObservableDemo(String weather) {
        this.weather = weather;
    }

    public String getWeather() {
        return weather;
    }

    public void setWeather(String weather) {
        this.weather = weather;
        //设置changed变量为true
//        如果不调用这个方法，就无法更新数据
        setChanged();
//        通知订阅者更新信息   "Message"对应Object data
        notifyObservers("Message");
    }
}
